import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  routes: [
    { path: '/', redirect: '/home' },
    { path: '/#', redirect: '/home' },
    {
      path: '/home',
      component: resolve => {
        require(['@/views/home/home'], resolve)
      }
    },
    {
      path: '/home',
      component: resolve => {
        require(['@/views/home/home'], resolve)
      }
    },
    {
      path: '/buyCar',
      name: '/buyCar',
      component: resolve => {
        require(['@/views/buyCar/buyCar'], resolve)
      },
      children: [
        {
          path: 'DetailsPage',
          name: '/buyCar/DetailsPage',
          component: resolve => {
            require(['@/views/buyCar/DetailsPage'], resolve)
          }
        },
        {
          path: 'Bidders',
          name: '/buyCar/Bidders',
          component: resolve => {
            require(['@/views/buyCar/Bidders'], resolve)
          }
        },
        {
          path: 'Bid',
          name: '/buyCar/Bid',
          component: resolve => {
            require(['@/views/buyCar/Bid'], resolve)
          }
        },
        {
          path: 'register',
          component: resolve => {
            require(['@/views/Login/register'], resolve)
          }
        },
        {
          path: 'modify',
          component: resolve => {
            require(['@/views/Login/modify'], resolve)
          }
        },
        {
          path: 'BidOffer',
          name: '/buyCar/BidOffer',
          component: resolve => {
            require(['@/views/buyCar/BidOffer'], resolve)
          }
        },
        {
          path: 'BiddersOffer',
          name: '/buyCar/BiddersOffer',
          component: resolve => {
            require(['@/views/buyCar/BiddersOffer'], resolve)
          }
        }
      ]
    },
    {
      path: '/sellingCar',
      component: resolve => {
        require(['@/views/sellingCar/sellingCar'], resolve)
      }
    },
    {
      path: '/login',
      redirect: '/login/login',
      component: resolve => {
        require(['@/views/Login/index'], resolve)
      },
      children: [
        {
          path: 'login',
          component: resolve => {
            require(['@/views/Login/login'], resolve)
          }
        },
        {
          path: 'register',
          component: resolve => {
            require(['@/views/Login/register'], resolve)
          }
        },
        {
          path: 'modify',
          component: resolve => {
            require(['@/views/Login/modify'], resolve)
          }
        }
      ]
    },
    {
      path: '/personal',
      redirect: '/personal/PersonalInformation',
      component: resolve => {
        require(['@/views/personal/index'], resolve)
      },
      children: [
        {
          path: 'PersonalInformation',
          component: resolve => {
            require(['@/views/personal/Childrens/PersonalInformation'], resolve)
          }
        },
        {
          path: 'deposit',
          component: resolve => {
            require(['@/views/personal/Childrens/deposit'], resolve)
          }
        },
        {
          path: 'MyCar',
          redirect: 'MyCar/aBuyCar',
          component: resolve => {
            require(['@/views/personal/Childrens/MyCar'], resolve)
          },
          children: [
            {
              path: 'aBuyCar',
              component: resolve => {
                require(['@/views/personal/Childrens/myCarChilds/aBuyCar'], resolve)
              }
            },
            {
              path: 'aSoldCar',
              component: resolve => {
                require(['@/views/personal/Childrens/myCarChilds/aSoldCar'], resolve)
              }
            }
          ]
        },
        {
          path: 'MyAttention',
          component: resolve => {
            require(['@/views/personal/Childrens/MyAttention'], resolve)
          }
        },
        {
          path: 'MyBid',
          component: resolve => {
            require(['@/views/personal/Childrens/MyBid'], resolve)
          }
        },
        {
          path: 'MyAuction',
          component: resolve => {
            require(['@/views/personal/Childrens/MyAuction'], resolve)
          }
        },
        {
          path: 'carDetails',
          name: '/personal/carDetails',
          component: resolve => {
            require(['@/views/personal/Childrens/carDetails'], resolve)
          }
        }
      ]
    }
  ]
})
